package gtv.sic.control;

import gtv.sic.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;


public class BuscarEventoActivity extends ListActivity {

	private Button buscar;
	private Button voltar;
	private Button listar;
	private EditText nome;

	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.busca_evento);
        
        nome = (EditText) findViewById(R.id.nome);
        listar = (Button) findViewById(R.id.buttonListar);
        buscar = (Button) findViewById(R.id.buttonBuscar);
        voltar = (Button) findViewById(R.id.buttonVoltar);
        
        
        listar.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				Intent intent = new Intent(BuscarEventoActivity.this, ListarEventoActivity.class);
				
				//consulta os eventos
				String [] listaEventos = {"evento a", "evento b", "evento c"};
				
				intent.putExtra("lista_eventos", listaEventos);
				
				startActivity(intent);
			}
		}); 
        
        buscar.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				Intent intent = new Intent(BuscarEventoActivity.this, ListarEventoActivity.class);
				
				//consulta os eventos
				String [] listaEventos = {""};
				listaEventos[0] = nome.getText().toString();
				
				intent.putExtra("lista_eventos", listaEventos);
				
				
				startActivity(intent);
			}
		});      
        
        voltar.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				Intent intent = new Intent(BuscarEventoActivity.this, MenuEventoActivity.class);
				
				startActivity(intent);
			}
		});
               
    }
    
}